Developer Documentation
PATH  WebObjects 4.5 Documentation > Getting Started With Direct to Java Client

   

Modifying the XML

Once you have the default XML as a starting point, you modify it in two ways:

The default XML describes the controller hierarchy for an entire window. You can freeze the XML for the entire window, but you shouldn't if you don't need to. If you let Direct to Java Client generate as much of the window as possible, you can still use the Assistant to configure those parts, which is an advantage.
Suppose the default XML for the select Studio dialog is the following:

<MODALDIALOGCONTROLLER reuseMode="ReuseIfInvisible"
disposeIfDeactivated="false" typeName="question = modalDialog,
task = select, entity = Studio">

    <ACTIONBUTTONSCONTROLLER widgetPosition="Top">
        <QUERYCONTROLLER entity="Studio" minimumWidth="256"
        alignsComponents="true">

            <TEXTFIELDCONTROLLER valueKey="name"
            isQueryWidget="true"/>

            <LISTCONTROLLER minimumWidth="256" editability="Never"
            alignsComponents="true" entity="Studio">

                <TABLECONTROLLER>
                    <TABLECOLUMNCONTROLLER editability="Never"
                    valueKey="name"/>

                    <TABLECOLUMNCONTROLLER valueKey="budget"
                    formatPattern="#,##0.00;-#,##0.00"
                    editability="Never"
                    formatClass=
                    "com.apple.client.foundation.NSNumberFormatter"/>

                </TABLECONTROLLER>
            </LISTCONTROLLER>
        </QUERYCONTROLLER>
    </ACTIONBUTTONSCONTROLLER>
</MODALDIALOGCONTROLLER>

To modify the XML, perform the following:

  1. Delete the XML for the modal dialog and for the button row.

    To put a box around the name query fields, you don't need to freeze the XML for the modal dialog controller (the MODALDIALOGCONTROLLER tag) or for the row of buttons (the ACTIONBUTTONSCONTROLLER tag). So first delete the first two and the last two lines of the XML.

  2. Add a box controller around the text field.

    The following lines add a box controller:

    <BOXCONTROLLER verticallyResizable="false" usesTitledBorder="true" color="255,0,0" font="+0,Italic">
    </BOXCONTROLLER>

    Put the opening BOXCONTROLLER tag above the lines for the text field controller and the closing BOXCONTROLLER tag below it. This inserts an EOBoxController in the controller hierarchy as a subcontroller of the EOQueryController and the supercontroller of the EOTextFieldController.

    The XML attributes of the BOXCONTROLLER tag specify that the box should not be vertically resizable, the box should have a title, and that the title's color is red and its font is Italic. The EOBoxController derives its title from its subcontroller, the text field controller. In this case, the box uses the text field controller's property, name. For more information on how the box controller works, see the EOBoxController class specification in the EOGeneration Framework Reference.

  3. Remove the label from the text field.

    Because you configured the box to have a title, the text field doesn't need a label. To remove the label, change the TEXTFIELDCONTROLLER line to the following:

    <TEXTFIELDCONTROLLER isQueryWidget="true" valueKey="name" usesLabelComponent="false"/>

    When you're done with the changes, the resulting XML should be:

    <QUERYCONTROLLER entity="Studio" minimumWidth="256"
    alignsComponents="true">

        <BOXCONTROLLER usesTitledBorder="true"
        verticallyResizable="false" color="255,0,0" font="+0,Italic">

            <TEXTFIELDCONTROLLER isQueryWidget="true" valueKey="name"
            usesLabelComponent="false"/>

        </BOXCONTROLLER>
        <LISTCONTROLLER minimumWidth="256" editability="Never"
        alignsComponents="true" entity="Studio">

            <TABLECONTROLLER>
                <TABLECOLUMNCONTROLLER editability="Never"
                valueKey="name"/>

                    <TABLECOLUMNCONTROLLER valueKey="budget"
                    formatPattern="#,##0.00;-#,##0.00"
                    editability="Never"
                    formatClass=
                    "com.apple.client.foundation.NSNumberFormatter"/>

            </TABLECONTROLLER>
        </LISTCONTROLLER>
    </QUERYCONTROLLER>


© 1999 Apple Computer, Inc. – (Draft. Last updated 05 Jan 00)